import React, { Component } from 'react'
import Son from '../components2/Son'

export default class Father extends Component {
    state = {
        count: 888
    }
    render() {
        const { count } = this.state
        return (
            <div>
                Father -- { count }
                {/* 父向子传值 */}
                {/* 1. 在子组件上自定义属性 */}
                {/* 2. 在函数式组件中通过形参来接收 */}
                {/* 3. 在类组件上通过this.props来接收 */}
                <Son count = { count }/>
                <button onClick={() => {
                    this.setState({
                        count: 999
                    })
                }}>+++</button>
            </div>
        )
    }
}
